package main

import (
	"fmt"
)

type Student struct {
	name string
	age int
}
func main() {
	//m := make(map[string]*Student)
	//stus := []Student{
	//	{name: "小王子", age: 18},
	//	{name: "娜扎", age: 23},
	//	{name: "大王八", age: 9000},
	//}
	//
	//for _, stu := range stus {
	//	m[stu.name] = &stu
	//	fmt.Printf("%p--%v\n",&stu,stu)
	//}
	//for k, v := range m {
	//	fmt.Println(k, "=>", v.name)
	//}
	//stu := Student{"wangbaoqiang",23}
	//stu.speak("hhh")
	//stu2 := stu
	//stu2.speak("jjj")
	//dog := Dog{name:"咪咪",age:1,father:&Animal{name:"咪咪"}}
	//dog.father.eat("屎")

}

func (stu *Student) speak(words string) {
	fmt.Println(stu.name,"说了一些话是",words)
}

type Dog struct {
	name string
	age int
	father *Animal
}
type Animal struct {
	name string
	age int
}

func (a *Animal) eat(thing string)  {
	fmt.Printf("我叫%s,我在吃%s",a.name,thing)
}

